namespace QMVnSoft.ReportForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormKQT05Viewer : FormReportViewer
    {
        private IContainer components;
        private object is_Mua_Ban_Ck = "";
        private LabelControl lblEmail;
        private LabelControl lblFax;
        private LabelControl lblNgay_Ct1;
        private LabelControl lblNgay_Ct2;
        private LabelControl lblPhone;
        private LabelControl lblQ_Huyen;
        private LabelControl lblTien_DN;
        private LabelControl lblTinh_TP;
        private LabelControl lblXa_Phuong;
        private TextControl txtEmail;
        private TextControl txtFax;
        private TextDate txtNgay_Ct1;
        private TextDate txtNgay_Ct2;
        private TextControl txtPhone;
        private TextControl txtQ_Huyen;
        private TextNumeric txtTien_DN;
        private TextControl txtTinh_TP;
        private TextControl txtXa_Phuong;

        public FormKQT05Viewer()
        {
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = AppInstance.StartWorkingDate;
            this.txtNgay_Ct2.Value = AppInstance.EndWorkingDate;
            this.txtXa_Phuong.Value = AppDataAccess.GetBuffer("TAX_SO_NHA");
            this.txtQ_Huyen.Value = AppDataAccess.GetBuffer("TAX_Q_HUYEN");
            this.txtTinh_TP.Value = AppDataAccess.GetBuffer("TAX_TINH_TP");
            this.txtPhone.Value = AppDataAccess.GetBuffer("TAX_PHONE_NO");
            this.txtFax.Value = AppDataAccess.GetBuffer("TAX_FAX_NO");
            this.txtEmail.Value = AppDataAccess.GetBuffer("TAX_EMAIL");
            object buffer = AppDataAccess.GetBuffer("TAX_TIEN_DN");
            this.txtTien_DN.Value = buffer;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormKQT05Viewer));
            this.lblTien_DN = new LabelControl();
            this.txtNgay_Ct2 = new TextDate();
            this.lblNgay_Ct2 = new LabelControl();
            this.txtNgay_Ct1 = new TextDate();
            this.lblNgay_Ct1 = new LabelControl();
            this.txtTien_DN = new TextNumeric();
            this.txtXa_Phuong = new TextControl();
            this.lblXa_Phuong = new LabelControl();
            this.txtQ_Huyen = new TextControl();
            this.txtTinh_TP = new TextControl();
            this.txtPhone = new TextControl();
            this.txtFax = new TextControl();
            this.txtEmail = new TextControl();
            this.lblQ_Huyen = new LabelControl();
            this.lblPhone = new LabelControl();
            this.lblEmail = new LabelControl();
            this.lblTinh_TP = new LabelControl();
            this.lblFax = new LabelControl();
            base.rptContainer.Panel1.SuspendLayout();
            base.rptContainer.SuspendLayout();
            base.SuspendLayout();
            base.rptContainer.Panel1.Controls.Add(this.txtFax);
            base.rptContainer.Panel1.Controls.Add(this.txtPhone);
            base.rptContainer.Panel1.Controls.Add(this.txtTinh_TP);
            base.rptContainer.Panel1.Controls.Add(this.txtQ_Huyen);
            base.rptContainer.Panel1.Controls.Add(this.txtEmail);
            base.rptContainer.Panel1.Controls.Add(this.txtXa_Phuong);
            base.rptContainer.Panel1.Controls.Add(this.txtTien_DN);
            base.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct2);
            base.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct2);
            base.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct1);
            base.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct1);
            base.rptContainer.Panel1.Controls.Add(this.lblEmail);
            base.rptContainer.Panel1.Controls.Add(this.lblFax);
            base.rptContainer.Panel1.Controls.Add(this.lblTinh_TP);
            base.rptContainer.Panel1.Controls.Add(this.lblPhone);
            base.rptContainer.Panel1.Controls.Add(this.lblQ_Huyen);
            base.rptContainer.Panel1.Controls.Add(this.lblXa_Phuong);
            base.rptContainer.Panel1.Controls.Add(this.lblTien_DN);
            base.rptContainer.SplitterDistance = 130;
            this.lblTien_DN.AutoSize = true;
            this.lblTien_DN.Font = new Font("Arial", 8.25f);
            this.lblTien_DN.Location = new Point(12, 0x1b);
            this.lblTien_DN.Name = "lblTien_DN";
            this.lblTien_DN.Size = new Size(0x69, 14);
            this.lblTien_DN.TabIndex = 0x57;
            this.lblTien_DN.Text = "Số tiền đề nghị hoàn";
            this.txtNgay_Ct2.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ct2.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ct2.Location = new Point(0x13c, 3);
            this.txtNgay_Ct2.Mask = "00/00/0000";
            this.txtNgay_Ct2.Name = "txtNgay_Ct2";
            this.txtNgay_Ct2.OldValue = null;
            this.txtNgay_Ct2.Size = new Size(100, 20);
            this.txtNgay_Ct2.TabIndex = 1;
//            this.txtNgay_Ct2.Value = null;//manager.GetObject("txtNgay_Ct2.Value");
            this.lblNgay_Ct2.AutoSize = true;
            this.lblNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ct2.Location = new Point(0x100, 6);
            this.lblNgay_Ct2.Name = "lblNgay_Ct2";
            this.lblNgay_Ct2.Size = new Size(0x36, 14);
            this.lblNgay_Ct2.TabIndex = 0x61;
            this.lblNgay_Ct2.Text = "Đến ngày";
            this.txtNgay_Ct1.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct1.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ct1.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ct1.Location = new Point(0x7b, 3);
            this.txtNgay_Ct1.Mask = "00/00/0000";
            this.txtNgay_Ct1.Name = "txtNgay_Ct1";
            this.txtNgay_Ct1.OldValue = null;
            this.txtNgay_Ct1.Size = new Size(100, 20);
            this.txtNgay_Ct1.TabIndex = 0;
//            this.txtNgay_Ct1.Value = null;//manager.GetObject("txtNgay_Ct1.Value");
            this.lblNgay_Ct1.AutoSize = true;
            this.lblNgay_Ct1.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ct1.Location = new Point(12, 6);
            this.lblNgay_Ct1.Name = "lblNgay_Ct1";
            this.lblNgay_Ct1.Size = new Size(0x2f, 14);
            this.lblNgay_Ct1.TabIndex = 0x62;
            this.lblNgay_Ct1.Text = "Từ ngày";
            this.txtTien_DN.Font = new Font("Arial", 8.25f);
            this.txtTien_DN.Location = new Point(0x7b, 0x18);
            this.txtTien_DN.Name = "txtTien_DN";
            int[] bits = new int[4];
            this.txtTien_DN.NumericValue = new decimal(bits);
            this.txtTien_DN.OldValue = null;
            this.txtTien_DN.Size = new Size(100, 20);
            this.txtTien_DN.TabIndex = 2;
            this.txtTien_DN.TextAlign = HorizontalAlignment.Right;
            this.txtTien_DN.UserTextNumericFormat = AppInstance.TextNumericFormat.LocalAmount;
//            this.txtTien_DN.Value = null;//manager.GetObject("txtTien_DN.Value");
            this.txtXa_Phuong.CheckTextSearched = false;
            this.txtXa_Phuong.DisabledForeColor = Color.Blue;
            this.txtXa_Phuong.Font = new Font("Arial", 8.25f);
            this.txtXa_Phuong.Location = new Point(0x7b, 0x2d);
            this.txtXa_Phuong.Name = "txtXa_Phuong";
            this.txtXa_Phuong.OldValue = null;
            this.txtXa_Phuong.Size = new Size(0x125, 20);
            this.txtXa_Phuong.TabIndex = 3;
//            this.txtXa_Phuong.Value = null;//manager.GetObject("txtXa_Phuong.Value");
            this.lblXa_Phuong.AutoSize = true;
            this.lblXa_Phuong.Font = new Font("Arial", 8.25f);
            this.lblXa_Phuong.Location = new Point(12, 0x30);
            this.lblXa_Phuong.Name = "lblXa_Phuong";
            this.lblXa_Phuong.Size = new Size(0x3d, 14);
            this.lblXa_Phuong.TabIndex = 0x57;
            this.lblXa_Phuong.Text = "X\x00e3 phường";
            this.txtQ_Huyen.CheckTextSearched = false;
            this.txtQ_Huyen.DisabledForeColor = Color.Blue;
            this.txtQ_Huyen.Font = new Font("Arial", 8.25f);
            this.txtQ_Huyen.Location = new Point(0x7b, 0x42);
            this.txtQ_Huyen.Name = "txtQ_Huyen";
            this.txtQ_Huyen.OldValue = null;
            this.txtQ_Huyen.Size = new Size(100, 20);
            this.txtQ_Huyen.TabIndex = 4;
//            this.txtQ_Huyen.Value = null;//manager.GetObject("txtQ_Huyen.Value");
            this.txtTinh_TP.CheckTextSearched = false;
            this.txtTinh_TP.DisabledForeColor = Color.Blue;
            this.txtTinh_TP.Font = new Font("Arial", 8.25f);
            this.txtTinh_TP.Location = new Point(0x13c, 0x42);
            this.txtTinh_TP.Name = "txtTinh_TP";
            this.txtTinh_TP.OldValue = null;
            this.txtTinh_TP.Size = new Size(100, 20);
            this.txtTinh_TP.TabIndex = 5;
//            this.txtTinh_TP.Value = null;//manager.GetObject("txtTinh_TP.Value");
            this.txtPhone.CheckTextSearched = false;
            this.txtPhone.DisabledForeColor = Color.Blue;
            this.txtPhone.Font = new Font("Arial", 8.25f);
            this.txtPhone.Location = new Point(0x7b, 0x57);
            this.txtPhone.Name = "txtPhone";
            this.txtPhone.OldValue = null;
            this.txtPhone.Size = new Size(100, 20);
            this.txtPhone.TabIndex = 6;
//            this.txtPhone.Value = null;//manager.GetObject("txtPhone.Value");
            this.txtFax.CheckTextSearched = false;
            this.txtFax.DisabledForeColor = Color.Blue;
            this.txtFax.Font = new Font("Arial", 8.25f);
            this.txtFax.Location = new Point(0x13c, 0x57);
            this.txtFax.Name = "txtFax";
            this.txtFax.OldValue = null;
            this.txtFax.Size = new Size(100, 20);
            this.txtFax.TabIndex = 7;
//            this.txtFax.Value = null;//manager.GetObject("txtFax.Value");
            this.txtEmail.CheckTextSearched = false;
            this.txtEmail.DisabledForeColor = Color.Blue;
            this.txtEmail.Font = new Font("Arial", 8.25f);
            this.txtEmail.Location = new Point(0x7b, 0x6c);
            this.txtEmail.Name = "txtEmail";
            this.txtEmail.OldValue = null;
            this.txtEmail.Size = new Size(0x125, 20);
            this.txtEmail.TabIndex = 8;
//            this.txtEmail.Value = null;//manager.GetObject("txtEmail.Value");
            this.lblQ_Huyen.AutoSize = true;
            this.lblQ_Huyen.Font = new Font("Arial", 8.25f);
            this.lblQ_Huyen.Location = new Point(12, 0x45);
            this.lblQ_Huyen.Name = "lblQ_Huyen";
            this.lblQ_Huyen.Size = new Size(0x45, 14);
            this.lblQ_Huyen.TabIndex = 0x57;
            this.lblQ_Huyen.Text = "Quận, huyện";
            this.lblPhone.AutoSize = true;
            this.lblPhone.Font = new Font("Arial", 8.25f);
            this.lblPhone.Location = new Point(12, 90);
            this.lblPhone.Name = "lblPhone";
            this.lblPhone.Size = new Size(0x37, 14);
            this.lblPhone.TabIndex = 0x57;
            this.lblPhone.Text = "Điện thoại";
            this.lblEmail.AutoSize = true;
            this.lblEmail.Font = new Font("Arial", 8.25f);
            this.lblEmail.Location = new Point(12, 0x6f);
            this.lblEmail.Name = "lblEmail";
            this.lblEmail.Size = new Size(0x1f, 14);
            this.lblEmail.TabIndex = 0x57;
            this.lblEmail.Text = "Email";
            this.lblTinh_TP.AutoSize = true;
            this.lblTinh_TP.Font = new Font("Arial", 8.25f);
            this.lblTinh_TP.Location = new Point(250, 0x45);
            this.lblTinh_TP.Name = "lblTinh_TP";
            this.lblTinh_TP.Size = new Size(60, 14);
            this.lblTinh_TP.TabIndex = 0x57;
            this.lblTinh_TP.Text = "Tỉnh, T.Phố";
            this.lblFax.AutoSize = true;
            this.lblFax.Font = new Font("Arial", 8.25f);
            this.lblFax.Location = new Point(0x11d, 90);
            this.lblFax.Name = "lblFax";
            this.lblFax.Size = new Size(0x19, 14);
            this.lblFax.TabIndex = 0x57;
            this.lblFax.Text = "Fax";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.ClientSize = new Size(0x31a, 0x1cf);
            base.Name = "FormKQT05Viewer";
            base.UserLastKey = Keys.Alt | Keys.Menu;
            base.rptContainer.Panel1.ResumeLayout(false);
            base.rptContainer.Panel1.PerformLayout();
            base.rptContainer.ResumeLayout(false);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        protected override void OnDeclare()
        {
            base.OnDeclare();
            new FormKQT05Lister().Show();
        }

        protected override void OnGenerateColumns()
        {
            object[][] objArray = new object[4][];
            object[] objArray2 = new object[4];
            objArray2[0] = "Stt0";
            objArray2[1] = "Mục";
            objArray2[2] = "C";
            objArray[0] = objArray2;
            object[] objArray3 = new object[4];
            objArray3[0] = "Dien_Giai";
            objArray3[1] = "Chỉ ti\x00eau k\x00ea khai";
            objArray3[2] = "C";
            objArray[1] = objArray3;
            objArray[2] = new object[] { "Tien", "Doanh số", "N", AppInstance.TextNumericFormat.LocalAmount };
            objArray[3] = new object[] { "Tien3", "Thuế GTGT", "N", AppInstance.TextNumericFormat.LocalAmount };
            base.LocalColNames = objArray;
            base.OnGenerateColumns();
        }

        protected override void OnMakeReport()
        {
            AppDataAccess.SetBuffer("TAX_SO_NHA", this.txtXa_Phuong.Text);
            AppDataAccess.SetBuffer("TAX_Q_HUYEN", this.txtQ_Huyen.Text);
            AppDataAccess.SetBuffer("TAX_TINH_TP", this.txtTinh_TP.Text);
            AppDataAccess.SetBuffer("TAX_PHONE_NO", this.txtPhone.Text);
            AppDataAccess.SetBuffer("TAX_FAX_NO", this.txtFax.Text);
            AppDataAccess.SetBuffer("TAX_EMAIL", this.txtEmail.Text);
            AppDataAccess.SetBuffer("TAX_TIEN_DN", this.txtTien_DN.Value.ToString());
            AppInstance.StartWorkingDate = (DateTime) this.txtNgay_Ct1.Value;
            AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct2.Value;
            object obj2 = "";
            base.LocalTable = new ReportDataAccess().KQT05_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtTien_DN.Value, ref obj2, AppInstance.DefLanguage);
            this.is_Mua_Ban_Ck = obj2;
            base.OnMakeReport();
        }

        protected override void OnSendParameters()
        {
            base.StimulReport["Ngay"] = "[01] Kỳ khai thuế: tháng  " + string.Format("{0:MM}", this.txtNgay_Ct1.Value) + " năm " + string.Format("{0:yyyy}", this.txtNgay_Ct1.Value);
            base.StimulReport["Ms_Thue"] = AppInstance.TaxCodeOfSubEnterprice;
            if (string.IsNullOrEmpty(this.txtXa_Phuong.Value.ToString()))
            {
                base.StimulReport["Xa_Phuong"] = "";
            }
            else
            {
                base.StimulReport["Xa_Phuong"] = this.txtXa_Phuong.Value;
            }
            if (string.IsNullOrEmpty(this.txtQ_Huyen.Value.ToString()))
            {
                base.StimulReport["Q_Huyen"] = "";
            }
            else
            {
                base.StimulReport["Q_Huyen"] = this.txtQ_Huyen.Value;
            }
            if (string.IsNullOrEmpty(this.txtTinh_TP.Value.ToString()))
            {
                base.StimulReport["Tinh_TP"] = "";
            }
            else
            {
                base.StimulReport["Tinh_TP"] = this.txtTinh_TP.Value;
            }
            if (string.IsNullOrEmpty(this.txtPhone.Value.ToString()))
            {
                base.StimulReport["Phone_No"] = "";
            }
            else
            {
                base.StimulReport["Phone_No"] = this.txtPhone.Value;
            }
            if (string.IsNullOrEmpty(this.txtFax.Value.ToString()))
            {
                base.StimulReport["Fax_No"] = "";
            }
            else
            {
                base.StimulReport["Fax_No"] = this.txtFax.Value;
            }
            if (string.IsNullOrEmpty(this.txtEmail.Value.ToString()))
            {
                base.StimulReport["Email_Addr"] = "";
            }
            else
            {
                base.StimulReport["Email_Addr"] = this.txtEmail.Value;
            }
        }

        protected override void OnShowDetail()
        {
            DataRow row = ((DataRowView) base.DataGridBrowser.CurrentRow.DataBoundItem).Row;
            int num = (int) row["Stt_Bac"];
            if (num == 9)
            {
                FormReportViewer viewer;
                string str = (string) row["Vao_Ra"];
                if (str == "1")
                {
                    viewer = new FormKCT071Viewer(this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value);
                    viewer.TitleText = "Sổ chi tiết tài khoản";
                    viewer.ReportTitle = "Sổ chi tiết tài khoản";
                    viewer.ReportFile = "KCT071";
                }
                else
                {
                    viewer = new FormKCT072Viewer(this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value);
                    viewer.TitleText = "Sổ chi tiết tài khoản";
                    viewer.ReportTitle = "Sổ chi tiết tài khoản";
                    viewer.ReportFile = "KCT072";
                }
                viewer.Show();
            }
        }
    }
}

